﻿<FluentDesignTheme StorageName="theme" />

<Router AppAssembly="typeof(Program).Assembly" 
        AdditionalAssemblies="new[] { typeof(Client._Imports).Assembly }" 
        OnNavigateAsync="OnNavigating">
    <Found Context="routeData">
        <RouteView RouteData="routeData" DefaultLayout="typeof(Shared.Layout.MainLayout)" />
        <FocusOnNavigate RouteData="routeData" Selector="h1" />
    </Found>
</Router>

@code {
    [Inject] public IJSRuntime JsRuntime { get; set; } = default!;

    private async void OnNavigating(NavigationContext navigationContext)
    {
        try
        {
            await JsRuntime.InvokeVoidAsync("startProgress");
        }
        catch {}
    }


    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
       try
        {
            await JsRuntime.InvokeVoidAsync("stopProgress");
        }
        catch {}
    }

}